package com.woniuxy.principal.service.impl;

import com.woniuxy.commons.entity.GradeTatolAvg;
import com.woniuxy.commons.entity.GradeTotalScore;
import com.woniuxy.commons.entity.SchoolGradeScore;
import com.woniuxy.commons.entity.WeakSubject;
import com.woniuxy.principal.mapper.GradeScoreDao;
import com.woniuxy.principal.service.GradeScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author： 雷鹏
 * Date: 2020/7/24 16:39
 */
@Service
public class GradeScoreServiceImpl implements GradeScoreService {
    @Autowired
    private GradeScoreDao gradeScoreDao;

    @Override
    public List<String> getGetTestType(String grade) {
        return gradeScoreDao.getGetTestType(grade);
    }

    //获取年级总平均成绩
    @Override
    public SchoolGradeScore getGradeTotalScore(String grade, String TestType) {

        List<GradeTatolAvg> gradeScore = gradeScoreDao.getGradeScore(grade, TestType);
        System.out.println(gradeScore);

        SchoolGradeScore schoolGradeScore = new SchoolGradeScore();
        int length = gradeScore.size();
        String[] school = new String[length];    //所有学校
        double[] tatolAvg = new double[length];  //所有学校年级平均成绩

        for (int i = 0; i < length; i++) {
            school[i] = gradeScore.get(i).getSName();
            tatolAvg[i] = gradeScore.get(i).getTotalAvg();
        }
        schoolGradeScore.setSchool(school);
        schoolGradeScore.setTatolAvg(tatolAvg);

        return schoolGradeScore;
    }

    //获取成绩分布个数
    @Override
    public String[][] getAllGradeScoreCount(String grade, String TestType) {

        List<GradeTotalScore> allGradeScore = gradeScoreDao.getAllGradeScore(grade, TestType);
        List<GradeTatolAvg> gradeScore = gradeScoreDao.getGradeScore(grade, TestType);  //获取学校个数
        System.out.println(allGradeScore);

        if ("高一".equals(grade)) {
            String[][] schoolScoreCounts = new String[gradeScore.size() + 1][6];
            schoolScoreCounts[0] = new String[]{"product", "0-199", "200-399", "400-599", "600-799", "800-950"};

            //循环学校
            for (int i = 0; i < gradeScore.size(); i++) {

                String[] schoolScoreCount = new String[6];
                int index1 = 0;  //0-199的人数
                int index2 = 0;  //200-399的人数
                int index3 = 0;  //400-599的人数
                int index4 = 0;  //600-799的人数
                int index5 = 0;  //800-950的人数

                //所有学校学生总成绩
                for (int j = 0; j < allGradeScore.size(); j++) {
                    //第一个学校的成绩
                    if (gradeScore.get(i).getSName().equals(allGradeScore.get(j).getSName())) {
                        //统计分数段人数
                        if (allGradeScore.get(j).getTotal() < 200) {
                            index1++;
                        } else if (allGradeScore.get(j).getTotal() < 400) {
                            index2++;
                        } else if (allGradeScore.get(j).getTotal() < 600) {
                            index3++;
                        } else if (allGradeScore.get(j).getTotal() < 800) {
                            index4++;
                        } else if (allGradeScore.get(j).getTotal() <= 950) {
                            index5++;
                        }

                    }
                }
                schoolScoreCount[0] = gradeScore.get(i).getSName();
                schoolScoreCount[1] = index1 + "";
                schoolScoreCount[2] = index2 + "";
                schoolScoreCount[3] = index3 + "";
                schoolScoreCount[4] = index4 + "";
                schoolScoreCount[5] = index5 + "";
                schoolScoreCounts[i + 1] = schoolScoreCount;
            }

            return schoolScoreCounts;
        } else {

            String[][] schoolScoreCounts = new String[gradeScore.size() + 1][6];
            schoolScoreCounts[0] = new String[]{"product", "0-199", "200-399", "400-499", "500-599", "600-750"};

            //循环学校
            for (int i = 0; i < gradeScore.size(); i++) {

                String[] schoolScoreCount = new String[6];
                int index1 = 0;  //0-199的人数
                int index2 = 0;  //200-399的人数
                int index3 = 0;  //400-499的人数
                int index4 = 0;  //500-599的人数
                int index5 = 0;  //600-750的人数

                //所有学校学生总成绩
                for (int j = 0; j < allGradeScore.size(); j++) {
                    //第一个学校的成绩
                    if (gradeScore.get(i).getSName().equals(allGradeScore.get(j).getSName())) {
                        //统计分数段人数
                        if (allGradeScore.get(j).getTotal() < 200) {
                            index1++;
                        } else if (allGradeScore.get(j).getTotal() < 400) {
                            index2++;
                        } else if (allGradeScore.get(j).getTotal() < 500) {
                            index3++;
                        } else if (allGradeScore.get(j).getTotal() < 600) {
                            index4++;
                        } else if (allGradeScore.get(j).getTotal() <= 750) {
                            index5++;
                        }

                    }
                }
                schoolScoreCount[0] = gradeScore.get(i).getSName();
                schoolScoreCount[1] = index1 + "";
                schoolScoreCount[2] = index2 + "";
                schoolScoreCount[3] = index3 + "";
                schoolScoreCount[4] = index4 + "";
                schoolScoreCount[5] = index5 + "";
                schoolScoreCounts[i + 1] = schoolScoreCount;
            }

            return schoolScoreCounts;
        }

    }

    //获取所有学科平均分
    @Override
    public WeakSubject getAllSubjectScoreAvg(String grade, String TestType, int sid) {

        List<GradeTatolAvg> gradeScore = gradeScoreDao.getGradeScore(grade, TestType);
        System.out.println(gradeScore);
        System.out.println(sid);

        WeakSubject weakSubject = new WeakSubject();
        if ("高一".equals(grade)) {
            String[][] subjectScoreAvg = new String[gradeScore.size() + 3][9];
            subjectScoreAvg[0] = new String[]{"product", "语文", "数学", "英语", "物理", "化学", "历史", "地理", "政治"};
            double[] SchoolsSubjectScoreAvg = new double[8];
            int index = -1;     //学校成绩下标
            for (int i = 0; i < gradeScore.size(); i++) {
                subjectScoreAvg[i + 3] = new String[]{gradeScore.get(i).getSName(), String.format("%.2f", gradeScore.get(i).getChineseScoreAvg()), String.format("%.2f", gradeScore.get(i).getMathScoreAvg()), String.format("%.2f", gradeScore.get(i).getEnglishScoreAvg()), String.format("%.2f", gradeScore.get(i).getPhysicsScoreAvg()), String.format("%.2f", gradeScore.get(i).getChemistryScoreAvg()), String.format("%.2f", gradeScore.get(i).getHistoryScoreAvg()), String.format("%.2f", gradeScore.get(i).getGeographyScoreAvg()), String.format("%.2f", gradeScore.get(i).getPoliticsScoreAvg())};
                SchoolsSubjectScoreAvg[0] += gradeScore.get(i).getChineseScoreAvg();
                SchoolsSubjectScoreAvg[1] += gradeScore.get(i).getMathScoreAvg();
                SchoolsSubjectScoreAvg[2] += gradeScore.get(i).getEnglishScoreAvg();
                SchoolsSubjectScoreAvg[3] += gradeScore.get(i).getPhysicsScoreAvg();
                SchoolsSubjectScoreAvg[4] += gradeScore.get(i).getChemistryScoreAvg();
                SchoolsSubjectScoreAvg[5] += gradeScore.get(i).getHistoryScoreAvg();
                SchoolsSubjectScoreAvg[6] += gradeScore.get(i).getGeographyScoreAvg();
                SchoolsSubjectScoreAvg[7] += gradeScore.get(i).getPoliticsScoreAvg();
                //记录学校成绩下标
                if (sid == gradeScore.get(i).getSid()) {
                    index = i;
                }
            }

            for (int i = 0; i < SchoolsSubjectScoreAvg.length; i++) {
                String format = String.format("%.2f", SchoolsSubjectScoreAvg[i] / gradeScore.size());
                SchoolsSubjectScoreAvg[i] = Double.parseDouble(format);
            }
            subjectScoreAvg[1] = new String[]{"全市平均成绩", SchoolsSubjectScoreAvg[0] + "", SchoolsSubjectScoreAvg[1] + "", SchoolsSubjectScoreAvg[2] + "", SchoolsSubjectScoreAvg[3] + "", SchoolsSubjectScoreAvg[4] + "", SchoolsSubjectScoreAvg[5] + "", SchoolsSubjectScoreAvg[6] + "", SchoolsSubjectScoreAvg[7] + ""};
            subjectScoreAvg[2] = new String[]{"本校平均成绩", String.format("%.2f", gradeScore.get(index).getChineseScoreAvg()), String.format("%.2f", gradeScore.get(index).getMathScoreAvg()), String.format("%.2f", gradeScore.get(index).getEnglishScoreAvg()), String.format("%.2f", gradeScore.get(index).getPhysicsScoreAvg()), String.format("%.2f", gradeScore.get(index).getChemistryScoreAvg()), String.format("%.2f", gradeScore.get(index).getHistoryScoreAvg()), String.format("%.2f", gradeScore.get(index).getGeographyScoreAvg()), String.format("%.2f", gradeScore.get(index).getPoliticsScoreAvg())};
            System.out.println(Arrays.toString(SchoolsSubjectScoreAvg));
            System.out.println(Arrays.toString(subjectScoreAvg[0]));
            System.out.println(Arrays.toString(subjectScoreAvg[1]));
            System.out.println(Arrays.toString(subjectScoreAvg[2]));
            List<String> weakSubjects = new ArrayList<>();
            if (gradeScore.get(index).getChineseScoreAvg() < SchoolsSubjectScoreAvg[0]) {
                System.out.println("语文");
                weakSubjects.add("语文");
            }
            if (gradeScore.get(index).getMathScoreAvg() < SchoolsSubjectScoreAvg[1]) {
                System.out.println("数学");
                weakSubjects.add("数学");
            }
            if (gradeScore.get(index).getEnglishScoreAvg() < SchoolsSubjectScoreAvg[2]) {
                System.out.println("英语");
                weakSubjects.add("英语");
            }
            if (gradeScore.get(index).getPhysicsScoreAvg() < SchoolsSubjectScoreAvg[3]) {
                System.out.println("物理");
                weakSubjects.add("物理");
            }
            if (gradeScore.get(index).getChemistryScoreAvg() < SchoolsSubjectScoreAvg[4]) {
                System.out.println("化学");
                weakSubjects.add("化学");
            }
            if (gradeScore.get(index).getHistoryScoreAvg() < SchoolsSubjectScoreAvg[5]) {
                System.out.println("历史");
                weakSubjects.add("历史");
            }
            if (gradeScore.get(index).getGeographyScoreAvg() < SchoolsSubjectScoreAvg[6]) {
                System.out.println("地理");
                weakSubjects.add("地理");
            }
            if (gradeScore.get(index).getPoliticsScoreAvg() < SchoolsSubjectScoreAvg[7]) {
                System.out.println("政治");
                weakSubjects.add("政治");
            }
            weakSubject.setAllSubject(subjectScoreAvg);
            weakSubject.setWeakSubject(weakSubjects);
            List<String> allSchoolScore = new ArrayList<>();
            allSchoolScore.add("语文: " + SchoolsSubjectScoreAvg[0] + "分 ");
            allSchoolScore.add("数学: " + SchoolsSubjectScoreAvg[1] + "分 ");
            allSchoolScore.add("英语: " + SchoolsSubjectScoreAvg[2] + "分 ");
            allSchoolScore.add("物理: " + SchoolsSubjectScoreAvg[3] + "分 ");
            allSchoolScore.add("化学: " + SchoolsSubjectScoreAvg[4] + "分 ");
            allSchoolScore.add("历史: " + SchoolsSubjectScoreAvg[5] + "分 ");
            allSchoolScore.add("地理: " + SchoolsSubjectScoreAvg[6] + "分 ");
            allSchoolScore.add("政治: " + SchoolsSubjectScoreAvg[7] + "分 ");
            weakSubject.setAllSchoolScore(allSchoolScore);

            List<String> thisScore = new ArrayList<>();
            thisScore.add("语文: " + String.format("%.2f", gradeScore.get(index).getChineseScoreAvg()) + "分 ");
            thisScore.add("数学: " + String.format("%.2f", gradeScore.get(index).getMathScoreAvg()) + "分 ");
            thisScore.add("英语: " + String.format("%.2f", gradeScore.get(index).getEnglishScoreAvg()) + "分 ");
            thisScore.add("物理: " + String.format("%.2f", gradeScore.get(index).getPhysicsScoreAvg()) + "分 ");
            thisScore.add("化学: " + String.format("%.2f", gradeScore.get(index).getChemistryScoreAvg()) + "分 ");
            thisScore.add("历史: " + String.format("%.2f", gradeScore.get(index).getHistoryScoreAvg()) + "分 ");
            thisScore.add("地理: " + String.format("%.2f", gradeScore.get(index).getGeographyScoreAvg()) + "分 ");
            thisScore.add("政治: " + String.format("%.2f", gradeScore.get(index).getPoliticsScoreAvg()) + "分 ");
            weakSubject.setThisScore(thisScore);

        } else {
            if (gradeScore.get(0) != null && gradeScore.get(0).getSubjectType().equals("1")) {

                String[][] subjectScoreAvg = new String[gradeScore.size() + 3][7];
                subjectScoreAvg[0] = new String[]{"product", "语文", "数学", "英语", "物理", "生物", "化学"};
                double[] SchoolsSubjectScoreAvg = new double[6];
                int index = -1;     //学校成绩下标
                for (int i = 0; i < gradeScore.size(); i++) {
                    subjectScoreAvg[i + 3] = new String[]{gradeScore.get(i).getSName(), String.format("%.2f", gradeScore.get(i).getChineseScoreAvg()), String.format("%.2f", gradeScore.get(i).getMathScoreAvg()), String.format("%.2f", gradeScore.get(i).getEnglishScoreAvg()), String.format("%.2f", gradeScore.get(i).getPhysicsScoreAvg()), String.format("%.2f", gradeScore.get(i).getBiologyScoreAvg()), String.format("%.2f", gradeScore.get(i).getChemistryScoreAvg())};
                    SchoolsSubjectScoreAvg[0] += gradeScore.get(i).getChineseScoreAvg();
                    SchoolsSubjectScoreAvg[1] += gradeScore.get(i).getMathScoreAvg();
                    SchoolsSubjectScoreAvg[2] += gradeScore.get(i).getEnglishScoreAvg();
                    SchoolsSubjectScoreAvg[3] += gradeScore.get(i).getPhysicsScoreAvg();
                    SchoolsSubjectScoreAvg[4] += gradeScore.get(i).getBiologyScoreAvg();
                    SchoolsSubjectScoreAvg[5] += gradeScore.get(i).getChemistryScoreAvg();

                    //记录学校成绩下标
                    if (sid == gradeScore.get(i).getSid()) {
                        index = i;
                    }
                }

                for (int i = 0; i < SchoolsSubjectScoreAvg.length; i++) {
                    String format = String.format("%.2f", SchoolsSubjectScoreAvg[i] / gradeScore.size());
                    SchoolsSubjectScoreAvg[i] = Double.parseDouble(format);
                }
                subjectScoreAvg[1] = new String[]{"全市平均成绩", SchoolsSubjectScoreAvg[0] + "", SchoolsSubjectScoreAvg[1] + "", SchoolsSubjectScoreAvg[2] + "", SchoolsSubjectScoreAvg[3] + "", SchoolsSubjectScoreAvg[4] + "", SchoolsSubjectScoreAvg[5] + ""};
                subjectScoreAvg[2] = new String[]{"本校平均成绩", String.format("%.2f", gradeScore.get(index).getChineseScoreAvg()), String.format("%.2f", gradeScore.get(index).getMathScoreAvg()), String.format("%.2f", gradeScore.get(index).getEnglishScoreAvg()), String.format("%.2f", gradeScore.get(index).getPhysicsScoreAvg()), String.format("%.2f", gradeScore.get(index).getBiologyScoreAvg()), String.format("%.2f", gradeScore.get(index).getChemistryScoreAvg())};
                System.out.println(Arrays.toString(SchoolsSubjectScoreAvg));
                System.out.println(Arrays.toString(subjectScoreAvg[0]));
                System.out.println(Arrays.toString(subjectScoreAvg[1]));
                System.out.println(Arrays.toString(subjectScoreAvg[2]));
                List<String> weakSubjects = new ArrayList<>();
                if (gradeScore.get(index).getChineseScoreAvg() < SchoolsSubjectScoreAvg[0]) {
                    System.out.println("语文");
                    weakSubjects.add("语文");
                }
                if (gradeScore.get(index).getMathScoreAvg() < SchoolsSubjectScoreAvg[1]) {
                    System.out.println("数学");
                    weakSubjects.add("数学");
                }
                if (gradeScore.get(index).getEnglishScoreAvg() < SchoolsSubjectScoreAvg[2]) {
                    System.out.println("英语");
                    weakSubjects.add("英语");
                }
                if (gradeScore.get(index).getPhysicsScoreAvg() < SchoolsSubjectScoreAvg[3]) {
                    System.out.println("物理");
                    weakSubjects.add("物理");
                }
                if (gradeScore.get(index).getBiologyScoreAvg() < SchoolsSubjectScoreAvg[4]) {
                    System.out.println("生物");
                    weakSubjects.add("生物");
                }
                if (gradeScore.get(index).getChemistryScoreAvg() < SchoolsSubjectScoreAvg[5]) {
                    System.out.println("化学");
                    weakSubjects.add("化学");
                }
                weakSubject.setAllSubject(subjectScoreAvg);
                weakSubject.setWeakSubject(weakSubjects);

                List<String> allSchoolScore = new ArrayList<>();
                allSchoolScore.add("语文: " + SchoolsSubjectScoreAvg[0] + "分 ");
                allSchoolScore.add("数学: " + SchoolsSubjectScoreAvg[1] + "分 ");
                allSchoolScore.add("英语: " + SchoolsSubjectScoreAvg[2] + "分 ");
                allSchoolScore.add("物理: " + SchoolsSubjectScoreAvg[3] + "分 ");
                allSchoolScore.add("生物: " + SchoolsSubjectScoreAvg[4] + "分 ");
                allSchoolScore.add("化学: " + SchoolsSubjectScoreAvg[5] + "分 ");
                weakSubject.setAllSchoolScore(allSchoolScore);

                List<String> thisScore = new ArrayList<>();
                thisScore.add("语文: " + String.format("%.2f", gradeScore.get(index).getChineseScoreAvg()) + "分 ");
                thisScore.add("数学: " + String.format("%.2f", gradeScore.get(index).getMathScoreAvg()) + "分 ");
                thisScore.add("英语: " + String.format("%.2f", gradeScore.get(index).getEnglishScoreAvg()) + "分 ");
                thisScore.add("物理: " + String.format("%.2f", gradeScore.get(index).getPhysicsScoreAvg()) + "分 ");
                thisScore.add("生物: " + String.format("%.2f", gradeScore.get(index).getBiologyScoreAvg()) + "分 ");
                thisScore.add("化学: " + String.format("%.2f", gradeScore.get(index).getChemistryScoreAvg()) + "分 ");
                weakSubject.setThisScore(thisScore);

            } else {


                String[][] subjectScoreAvg = new String[gradeScore.size() + 3][7];
                subjectScoreAvg[0] = new String[]{"product", "语文", "数学", "英语", "历史", "地理", "政治"};
                double[] SchoolsSubjectScoreAvg = new double[6];
                int index = -1;     //学校成绩下标
                for (int i = 0; i < gradeScore.size(); i++) {
                    subjectScoreAvg[i + 3] = new String[]{gradeScore.get(i).getSName(), String.format("%.2f", gradeScore.get(i).getChineseScoreAvg()), String.format("%.2f", gradeScore.get(i).getMathScoreAvg()), String.format("%.2f", gradeScore.get(i).getEnglishScoreAvg()), String.format("%.2f", gradeScore.get(i).getHistoryScoreAvg()), String.format("%.2f", gradeScore.get(i).getGeographyScoreAvg()), String.format("%.2f", gradeScore.get(i).getPoliticsScoreAvg())};
                    SchoolsSubjectScoreAvg[0] += gradeScore.get(i).getChineseScoreAvg();
                    SchoolsSubjectScoreAvg[1] += gradeScore.get(i).getMathScoreAvg();
                    SchoolsSubjectScoreAvg[2] += gradeScore.get(i).getEnglishScoreAvg();
                    SchoolsSubjectScoreAvg[3] += gradeScore.get(i).getHistoryScoreAvg();
                    SchoolsSubjectScoreAvg[4] += gradeScore.get(i).getGeographyScoreAvg();
                    SchoolsSubjectScoreAvg[5] += gradeScore.get(i).getPoliticsScoreAvg();
                    //记录学校成绩下标
                    if (sid == gradeScore.get(i).getSid()) {
                        index = i;
                    }
                }

                for (int i = 0; i < SchoolsSubjectScoreAvg.length; i++) {
                    String format = String.format("%.2f", SchoolsSubjectScoreAvg[i] / gradeScore.size());
                    SchoolsSubjectScoreAvg[i] = Double.parseDouble(format);
                }
                subjectScoreAvg[1] = new String[]{"全市平均成绩", SchoolsSubjectScoreAvg[0] + "", SchoolsSubjectScoreAvg[1] + "", SchoolsSubjectScoreAvg[2] + "", SchoolsSubjectScoreAvg[3] + "", SchoolsSubjectScoreAvg[4] + "", SchoolsSubjectScoreAvg[5] + ""};
                subjectScoreAvg[2] = new String[]{"本校平均成绩", String.format("%.2f", gradeScore.get(index).getChineseScoreAvg()), String.format("%.2f", gradeScore.get(index).getMathScoreAvg()), String.format("%.2f", gradeScore.get(index).getEnglishScoreAvg()), String.format("%.2f", gradeScore.get(index).getHistoryScoreAvg()), String.format("%.2f", gradeScore.get(index).getGeographyScoreAvg()), String.format("%.2f", gradeScore.get(index).getPoliticsScoreAvg())};
                System.out.println(Arrays.toString(SchoolsSubjectScoreAvg));
                System.out.println(Arrays.toString(subjectScoreAvg[0]));
                System.out.println(Arrays.toString(subjectScoreAvg[1]));
                System.out.println(Arrays.toString(subjectScoreAvg[2]));
                List<String> weakSubjects = new ArrayList<>();
                if (gradeScore.get(index).getChineseScoreAvg() < SchoolsSubjectScoreAvg[0]) {
                    System.out.println("语文");
                    weakSubjects.add("语文");
                }
                if (gradeScore.get(index).getMathScoreAvg() < SchoolsSubjectScoreAvg[1]) {
                    System.out.println("数学");
                    weakSubjects.add("数学");
                }
                if (gradeScore.get(index).getEnglishScoreAvg() < SchoolsSubjectScoreAvg[2]) {
                    System.out.println("英语");
                    weakSubjects.add("英语");
                }
                if (gradeScore.get(index).getHistoryScoreAvg() < SchoolsSubjectScoreAvg[3]) {
                    System.out.println("历史");
                    weakSubjects.add("历史");
                }
                if (gradeScore.get(index).getGeographyScoreAvg() < SchoolsSubjectScoreAvg[4]) {
                    System.out.println("地理");
                    weakSubjects.add("地理");
                }
                if (gradeScore.get(index).getPoliticsScoreAvg() < SchoolsSubjectScoreAvg[5]) {
                    System.out.println("政治");
                    weakSubjects.add("政治");
                }
                weakSubject.setAllSubject(subjectScoreAvg);
                weakSubject.setWeakSubject(weakSubjects);

                List<String> allSchoolScore = new ArrayList<>();
                allSchoolScore.add("语文: " + SchoolsSubjectScoreAvg[0] + "分 ");
                allSchoolScore.add("数学: " + SchoolsSubjectScoreAvg[1] + "分 ");
                allSchoolScore.add("英语: " + SchoolsSubjectScoreAvg[2] + "分 ");
                allSchoolScore.add("历史: " + SchoolsSubjectScoreAvg[3] + "分 ");
                allSchoolScore.add("地理: " + SchoolsSubjectScoreAvg[4] + "分 ");
                allSchoolScore.add("政治: " + SchoolsSubjectScoreAvg[5] + "分 ");
                weakSubject.setAllSchoolScore(allSchoolScore);

                List<String> thisScore = new ArrayList<>();
                thisScore.add("语文: " + String.format("%.2f", gradeScore.get(index).getChineseScoreAvg()) + "分 ");
                thisScore.add("数学: " + String.format("%.2f", gradeScore.get(index).getMathScoreAvg()) + "分 ");
                thisScore.add("英语: " + String.format("%.2f", gradeScore.get(index).getEnglishScoreAvg()) + "分 ");
                thisScore.add("历史: " + String.format("%.2f", gradeScore.get(index).getHistoryScoreAvg()) + "分 ");
                thisScore.add("地理: " + String.format("%.2f", gradeScore.get(index).getGeographyScoreAvg()) + "分 ");
                thisScore.add("政治: " + String.format("%.2f", gradeScore.get(index).getPoliticsScoreAvg()) + "分 ");
                weakSubject.setThisScore(thisScore);

            }

        }

        String[][] allSubject = weakSubject.getAllSubject();
        String[][] newAllSubject = new String[allSubject[0].length][allSubject.length];

        for (int i = 0; i < allSubject.length; i++) {
            for (int j = 0; j < allSubject[i].length; j++) {
                newAllSubject[j][i] = allSubject[i][j];
            }
        }

        weakSubject.setAllSubject(newAllSubject);
        return weakSubject;
    }
}
